<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax Demo</title>
    <style>
        .fs {
            width: 45%;
        }
    </style>
</head>
<body>
    <div>
        <h1>AJAX Get Request Test</h1>
        <fieldset class="fs">
            <legend>异步请求</legend>
            <button onclick="doAjaxGet()">Request</button>
            <span id="ajaxResultId">loading data...</span>
        </fieldset>
    </div>
    <script>
        function doAjaxGet() {
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange=function(){
                if(xhr.readyState==4&&xhr.status==200) {
                    console.log(xhr.responseText);
                }
            };
            xhr.open("GET","http://localhost/doAjaxStart",true);
            xhr.send();
        }
    </script>
</body>
</html>